package models;

import play.db.jpa.Model;

import javax.persistence.*;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: bicho
 * Date: 20/01/12
 * Time: 22:56
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "person_document")
public class PersonDocument extends Model{

    @ManyToOne
    public Person person;

    @Column(name = "code")
    public String code;

    //TODO analize if DocumentType is Id too
    @ManyToOne
    public DocumentType documentType;

    @OneToMany(mappedBy = "personDocument")
    public List<Inscription> inscriptions;

    @Override
    public String toString() {
        return documentType + "-" + code;
    }

}
